package cz.jm.web.jmlib.client.dialog.validation.validators;

import cz.jm.web.jmlib.client.dialog.validation.HasValidationValue;
import cz.jm.web.jmlib.client.dialog.validation.Validator;

public class ValueVerificationValidator implements Validator {

	HasValidationValue baseValueHolder;
	HasValidationValue verificationValueHolder;
	
	public ValueVerificationValidator(HasValidationValue baseValueHolder, HasValidationValue verificationValueHolder) {
		this.baseValueHolder = baseValueHolder;
		this.verificationValueHolder = verificationValueHolder;
	}
	@Override
    public boolean validate() {		
	    return baseValueHolder.getValidationValue().equals(verificationValueHolder.getValidationValue());
    }

	@Override
    public String getValidationFailMessage() {
	    return constants.verificationFailed();
    }

}
